feat: enhance ALTER TABLE support with UNIQUE KEY and INVISIBLE index - #2234
Conversation
|
Could you please let me know when the JSqlParser 5.2 release is scheduled? Thanks! |
Unfortunately this is not on me, but I will ask @wumpz immediately and with some luck, he will get this done in May. |
|
Please fix formatting exceptions. |
|
@manticore-projects I'm currently working on a project that depends on JSqlParser, and I'm considering switching to the official release version rather than using a custom build. |
|
Thank you for your work and effort! Cheers! |
…ABLE and CREATE INDEX MySQL 8.0 invisible indexes (KEY idx (col) INVISIBLE) and invisible columns failed to parse inside CREATE TABLE, and CREATE INDEX ... INVISIBLE failed too, because CreateParameter() did not accept the K_VISIBLE/K_INVISIBLE tokens. The ALTER TABLE productions already support them (JSQLParser#2076 was fixed for ALTER TABLE only, via JSQLParser#2234); this covers the CREATE statements, which share CreateParameter(). Tests cover index and column visibility, mixing visibility with other index options in either order, and quoted columns named visible/invisible. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ABLE and CREATE INDEX (#2449) MySQL 8.0 invisible indexes (KEY idx (col) INVISIBLE) and invisible columns failed to parse inside CREATE TABLE, and CREATE INDEX ... INVISIBLE failed too, because CreateParameter() did not accept the K_VISIBLE/K_INVISIBLE tokens. The ALTER TABLE productions already support them (#2076 was fixed for ALTER TABLE only, via #2234); this covers the CREATE statements, which share CreateParameter(). Tests cover index and column visibility, mixing visibility with other index options in either order, and quoted columns named visible/invisible. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Description
This PR adds support for two MySQL DDL statements:
ALTER TABLE ADD CONSTRAINT UNIQUE KEY syntaxALTER TABLE ALTER INDEX INVISIBLE syntaxProblem Solved
Previously, JSqlParser couldn't properly parse the following SQL statements:
These are valid MySQL syntax for adding a unique constraint with a custom name and for making an index invisible to the query optimizer while keeping it maintained.
Related Issue
#2076